import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { HeaderVO, HeaderForm, HeaderQuery } from '@/api/kitchen/invoice/types';

/**
 * 查询发票抬头列表
 * @param query
 * @returns {*}
 */

export const listHeader = (query?: HeaderQuery): AxiosPromise<HeaderVO[]> => {
  return request({
    url: '/kitchen/invoice/header/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询发票抬头详细
 * @param id
 */
export const getHeader = (id: string | number): AxiosPromise<HeaderVO> => {
  return request({
    url: '/kitchen/invoice/header/' + id,
    method: 'get'
  });
};

/**
 * 新增发票抬头
 * @param data
 */
export const addHeader = (data: HeaderForm) => {
  return request({
    url: '/kitchen/invoice/header',
    method: 'post',
    data: data
  });
};

/**
 * 修改发票抬头
 * @param data
 */
export const updateHeader = (data: HeaderForm) => {
  return request({
    url: '/kitchen/invoice/header',
    method: 'put',
    data: data
  });
};

/**
 * 删除发票抬头
 * @param id
 */
export const delHeader = (id: string | number | Array<string | number>) => {
  return request({
    url: '/kitchen/invoice/header/' + id,
    method: 'delete'
  });
};
